package com.stu.stusystem.model.system.serviceInformation;

import com.stu.stusystem.util.ArithUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.ToString;

@ToString
public class Mem {
    @ApiModelProperty("内存总量")
    private double total;

    @ApiModelProperty("已用内存")
    private double used;

    @ApiModelProperty("剩余内存")
    private double free;

    public double getTotal() {
        return ArithUtil.merchant(total, (1024 * 1024 * 1024), 2);
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public double getUsed() {
        return ArithUtil.merchant(used, (1024 * 1024 * 1024), 2);
    }

    public void setUsed(long used) {
        this.used = used;
    }

    public double getFree() {
        return ArithUtil.merchant(free, (1024 * 1024 * 1024), 2);
    }

    public void setFree(long free) {
        this.free = free;
    }

    @ApiModelProperty("内存使用率")
    public double getUsage() {
        return ArithUtil.mul(ArithUtil.merchant(used, total, 4), 100);
    }
}
